package com.example.testapp.activity.http;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

/**
 * Created by l on 2016/9/12.
 */
public class AsyncHttpUtil {

    private static AsyncHttpClient client = new AsyncHttpClient(); // 实例话对象

    static {
        client.setTimeout(10000);  // 设置链接超时，如果不设置，默认为10s
    }

    /**
     *  get 用一个完整url获取一个string对象
     * @param urlString
     * @param res
     */
    public static void get(String urlString, AsyncHttpResponseHandler res) {
        client.get(urlString, res);
    }

    /**
     * get url里面带参数
     * @param urlString
     * @param params
     * @param res
     */
    public static void get(String urlString, RequestParams params, AsyncHttpResponseHandler res) {
        client.get(urlString, params, res);
    }


}
